feat: support custom request headers#105
Open
javorosas wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for supplying custom request headers via Facturapi constructor options, merging them into the wrapper’s defaults while keeping the SDK-generated Authorization header as the intended source of truth across Node and web-like runtimes.
Changes:
- Add
headerstoFacturapiOptionsand pass them into the request wrapper. - Merge custom headers with default request headers and extend runtime compatibility tests to verify behavior (including multipart/FormData requests).
- Bump version to
4.17.0and add a changelog entry for the feature.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/web/runtime-compat.web.test.ts | Adds web-sim tests asserting custom headers are sent and multipart requests don’t force Content-Type. |
| test/node/runtime-compat.node.test.ts | Adds Node runtime test asserting custom headers are sent and Authorization remains SDK-controlled. |
| src/wrapper.ts | Accepts custom headers in createWrapper and merges them into default headers. |
| src/index.ts | Extends FacturapiOptions with headers and wires it into createWrapper. |
| package.json | Version bump to 4.17.0. |
| package-lock.json | Lockfile version bump to 4.17.0. |
| CHANGELOG.md | Adds changelog entry for custom request headers feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
headerstoFacturapiOptionsso callers can attach custom headers to SDK requests.Authorizationauthoritative.Content-Type.4.17.0and add the changelog entry under the existing unpublished4.17.0section.Validation
npm run buildnpm run test:unitnpm run test:typesRelease note
npm currently has
facturapi@4.16.0as latest, so merging this version bump tomainshould publish4.17.0via the deploy workflow.